﻿$(function () {
    $('a[href*=show-reservation]').click(function (e) {
        $('form:eq(0)').submit();
        e.preventDefault();
    });
    $('.send-act').css('cursor', 'pointer').click(function () { sendReservation(); });
});

function sendReservation() {
    $.ajax({
        url: '/Handlers/ApartsService.asmx/SendNotification',
        type: 'POST',
        data: "{'reservationNumber': '" + $('input[id*=txtReservationNumber]').val() + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: 'json',
        success: function (msg) {
            $('.send-progress').hide();
            $('.send-success').show();
        },
        error: function (msg) { console.log(msg['d']); },
        beforeSend: function () {
            $('.send-act').hide();
            $('.send-progress').show();
        }
    });
}